package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DdUserDiscountMapper;
import com.ruoyi.system.domain.DdUserDiscount;
import com.ruoyi.system.service.IDdUserDiscountService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用户优惠卷Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-04-12
 */
@Service
public class DdUserDiscountServiceImpl implements IDdUserDiscountService 
{
    @Autowired
    private DdUserDiscountMapper ddUserDiscountMapper;

    /**
     * 查询用户优惠卷
     * 
     * @param uuid 用户优惠卷ID
     * @return 用户优惠卷
     */
    @Override
    public DdUserDiscount selectDdUserDiscountById(String uuid)
    {
        return ddUserDiscountMapper.selectDdUserDiscountById(uuid);
    }

    /**
     * 查询用户优惠卷列表
     * 
     * @param ddUserDiscount 用户优惠卷
     * @return 用户优惠卷
     */
    @Override
    public List<DdUserDiscount> selectDdUserDiscountList(DdUserDiscount ddUserDiscount)
    {
        return ddUserDiscountMapper.selectDdUserDiscountList(ddUserDiscount);
    }

    /**
     * 新增用户优惠卷
     * 
     * @param ddUserDiscount 用户优惠卷
     * @return 结果
     */
    @Override
    public int insertDdUserDiscount(DdUserDiscount ddUserDiscount)
    {
        ddUserDiscount.setCreateTime(DateUtils.getNowDate());
        return ddUserDiscountMapper.insertDdUserDiscount(ddUserDiscount);
    }

    /**
     * 修改用户优惠卷
     * 
     * @param ddUserDiscount 用户优惠卷
     * @return 结果
     */
    @Override
    public int updateDdUserDiscount(DdUserDiscount ddUserDiscount)
    {
        return ddUserDiscountMapper.updateDdUserDiscount(ddUserDiscount);
    }

    /**
     * 删除用户优惠卷对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteDdUserDiscountByIds(String ids)
    {
        return ddUserDiscountMapper.deleteDdUserDiscountByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户优惠卷信息
     * 
     * @param uuid 用户优惠卷ID
     * @return 结果
     */
    @Override
    public int deleteDdUserDiscountById(String uuid)
    {
        return ddUserDiscountMapper.deleteDdUserDiscountById(uuid);
    }
}
